Running a Macro in Access

I'm trying to run a macro in an access database from DXL.  The code I'm using is as follows:-

 

OleAutoObj objAccess = oleCreateAutoObject("Access.Application")
OleAutoArgs autoArgs = create
string theDb = "C:\\Users\\sadri\\Desktop\\KPI Database\\update Dec 21\\KPI.accdb"
string theMacro = "AutoEx"
if (objAccess != null)
{
string err
bool accessVisible
err = oleGet(objAccess, "Visible", accessVisible)
if (accessVisible == false) err = olePut(objAccess, "Visible", true)
 
put(autoArgs, theDb )
err = oleMethod(objAccess, "OpenCurrentDatabase", autoArgs)
 
clear autoArgs
put(autoArgs, theMacro)
err = oleMethod(objAccess, "DoCmd.RunMacro", autoArgs)
if(err != "") errorBox "Failed to run Macro (" theMacro ").\nerr = '" err "'"
else ack "Should be Updated"
err = oleMethod(objAccess, "CloseCurrentDatabase")
 
}else errorBox "objAccess is Null"

 

It opens access, loads the database but returns an error message "Problem with OLE Argument names" from the oleMethod running the macro.

The macro exists, the name is correct and it works fine when run directly from the access database,

Any ideas?


TheRat - Fri Dec 21 05:30:13 EST 2018